package polymorphism;

 abstract class Rodent {
    private String name = "Rodent";
    abstract protected void run();
    abstract protected void eat();
    public String toString(){
        return name;
    }
}

class Mouse extends Rodent {
    private String name = "Mouse";
    protected void run(){
        System.out.println("Mouse run");
    }
    protected void eat(){
        System.out.println("Mouse eat");
    }
    public String toString(){
        return name;
    }
}

class Gerbil extends Rodent {
    private String name = "Gerbil";
    protected void run(){
        System.out.println("Gerbil run");
    }
    protected void eat(){
        System.out.println("Gerbil eat");
    }
    public String toString(){
        return name;
    }
}

class Hamster extends Rodent {
    private String name = "Hamster";
    protected void run(){
        System.out.println("Hamster run");
    }
    protected void eat(){
        System.out.println("Hamster eat");
    }
    public String toString(){
        return name;
    }
}

public class redentClass {
    private static RandomRodentGenerator gen = new RandomRodentGenerator();
    public static void main(String[] args) {
        Rodent[] rodents = new Rodent[10];
        for(Rodent r : rodents) {
            r = gen.next();
            System.out.println(r + ": ");
            r.eat();
            r.run();
        }
    }
}
